package com.qf.smsplatfrom.controller.swagger;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

import javax.swing.plaf.basic.BasicToolBarUI;

@Configuration//声明这是一个配置类
@EnableSwagger2//开启在线文档的注解
public class SwaggerConfig {

    @Bean
    public ApiInfo apiInfo(){
        return new ApiInfoBuilder()
                .version("2.1.0.alpha")//版本号
                .description("沙雕前端，拿钱多多还不干活")//接口文档的名称
                .title("沙雕前端")//接口文档的名字
                .license("apache2.0")//开源协议
                .licenseUrl("https://www.apache.org/licenses/LICENSE-2.0")//开源协议的地址
                .contact(new Contact("后端父亲","houduan.com","houduan@.com"))//声明你的联系方式，包括姓名，地址，还有邮箱
                .build();
    }

    @Bean
    public Docket docket(ApiInfo apiInfo){
       return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo)
        .select().apis(RequestHandlerSelectors.basePackage("com.qf.smsplatfrom.controller")).build();
    }

}
